	layui.use(['element','form','carousel','laytpl','layer','table'], function(){
		  var element = layui.element;
		  var carousel = layui.carousel;
		  var form = layui.form;
		  var laytpl = layui.laytpl;
		  var layer = layui.Layer;
		  var $ =layui.$
		  var table = layui.table;
			 var studentNo ;
		  var paperId ;
		  //取sessionStorage里面的userKey
	
		  	var studentInfo = document.getElementById("studentInfo").innerHTML;
		  	var userKey = JSON.parse(sessionStorage.getItem("userKey"));
		  	console.log(userKey)		  	
		  	if (userKey) {
		  		//如果存在,则说明登录过,先比对过期时间
		  		var delayTime = userKey.delayTime
		  		var nowTime = new Date().getTime()
		  		if(nowTime < delayTime){
		  			//登录未失效
		  			laytpl(studentInfo).render(userKey,function(html){
		  					$("#studentInfoView").html(html)
		  					element.render()
		  			})
		  		}
		  	}
		 
		  
		  //渲染表格
		  var table = layui.table;
  			var userKey = JSON.parse(sessionStorage.getItem("userKey"));
	 		 table.render({
			    elem: '#score'	   
			    ,url: 'http://localhost:8888/studentPaper/paperOfStudentDetail/' + userKey.studentNo  //数据接口
			    ,page: false //开启分页
			    ,cols: [[ //表头
			      {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
			      ,{field: 'paperId', title: '试卷id', width:80}
			      ,{field: 'title', title: '试卷名称', width:200}
			      ,{field: 'isDone', title: '完成情况', templet: function(d){
				       return d.isDone == 0 ? '<a href="exam.html"><span style="color:red">未完成</sapn></a>':'<span style="color:green">完成</sapn>'
		      },width:120, sort: true}
			      ,{field: 'score', title: '评级', width:80,templet:function(d){
			      	var score = d.score 
			      	var count = d.questionCount * 3
//			      	console.log(d)
			      	var rate = score/count
//			      	console.log(rate)
			      	if(score == null){
			      		return ""
			      	}else{
			      		if(rate <0.3){
			      		return '<span style="color:red">C</span>'
				      	}else if(score/count<0.6){
				      		return '<span style="color:orange">B</span>'
				      	}else{
				      		return  '<span style="color:green">A</span>'
				      	}
			      	}
			      	
			      	
			      }}
			      ,{field: 'comment', title: '教师评语'}
			    ]]
				  });
			    //表格渲染
		});
			//退出方法
		function logout(){
		  	sessionStorage.clear();
		  	location.href ='../login.html'
		  }
		
	
	